class Food {
    elment: HTMLElement

    constructor() {
        this.elment = document.querySelector('.food')
    }

    // 获取食物X轴坐标
    get X() {
        return this.elment.offsetLeft
    }

    // 获取食物Y轴坐标
    get Y() {
        return this.elment.offsetTop
    }

    change() {
        // 食物范围 0-290
        let radx = Math.floor(Math.random() * 30) * 10
        let rady = Math.floor(Math.random() * 30) * 10

        this.elment.style.left = radx + 'px'
        this.elment.style.top = rady + 'px'
    }
}

export default Food
